
#include <iostream>
#include "EPDADeserializer.h"

using namespace std;

char readin(string& str) 
{
	char c;
	while (cin >> c) 
	{
		if (c == '(' || c == ')' || c == ',')
			break;
		str.push_back(c);
	}
	return c;
}

int main() 
{
	EPDADeserializer deEPDA;
	try 
	{
		deEPDA.load("acallb.model");
		EPDA *epda = deEPDA.getEPDA();

		freopen("o.txt", "r", stdin);
		char c;
		string name;
		while (cin.peek() != EOF) 
		{
			name.clear(), readin(name);
			Method m(name);
			string para;
			while (para.clear(), c = readin(para))
			{
				if (para.size() > 0)
					m.addPara(para);
				if (c == ')') break;
			}
			cin >> c;
			vector<string> paras;
			while (para.clear(), c = readin(para))
			{
				if (para.size() > 0)
					paras.push_back(para);
				if (c == ')') break;
			}
			if (!epda->transfer(m, paras))
			{
				cout << "error:" << name << endl;
				return 0;
			}
		}

		cout << "ok" << endl;
	}
	catch(const char* message)
	{
		cout << message << endl;
	}

}